﻿<hi:common_vheader runat="server" />
<div class="pbox">
    <asp:hyperlink id="productLink" runat="server">
      
            <div class="well goods-box">
                <img runat="server" id="productImage" />
                <div class="info">
                    <div class="name font-xl"> <asp:literal runat="server" id="litProdcutName" /></div>
                    <div class="intro font-m text-muted"><asp:literal runat="server" id="litShortDescription" /></div>
                    <div class="price text-danger">
                        ¥<asp:literal runat="server" id="litSalePrice" />
                        <span class="sales font-s text-muted">已售<asp:literal runat="server" id="litSoldCount" />件</span>
                    </div>
                </div>
            </div>
        </asp:hyperlink>
    <textarea id="review" class="form-control" rows="3" placeholder="请填写您对该商品的评价"></textarea>
    <button type="button" onclick="Submit()" class="btn btn-warning btn-block">
        提交评价</button>
    <div id="reviews">
        <hr />
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">
                    全部评价</h3>
            </div>
            <div class="panel-body" id="reviewsList">
                <hi:vshoptemplatedrepeater id="rptProducts" templatefile="/Tags/skin-Common_ProductReview.ascx"
                    runat="server" />
            </div>
        </div>
        <div id="pager">
</div>
    </div>
</div>

<input type="hidden" clientidmode="Static" value="" runat="server" id="txtTotal" />
<hi:common_vfooter runat="server" />
<script src="http://res.juseshop.com/utility/common.js" type="text/javascript"></script>
<script src="http://res.juseshop.com/utility/pager.js" type="text/javascript"></script>
<script type="text/javascript">
    function Submit() {
        var reviewText = $("#review").val();
        if (!$.trim(reviewText)) {
            alert_h('请输入评论内容!');
        }
        else {
            var id = window.location.search.substr(window.location.search.indexOf("=") + 1);
            var data = {};
            data.ProductId = id;
            data.ReviewText = reviewText;
            $.post("/api/VshopProcess.ashx?action=AddProductReview", data, function (json) {
                if (json.success === true) {
                    alert_h("提交成功", function () {
                        location.reload();
                    });
                   
                }
                else {
                    alert_h(json.msg);
                }
            });
           

         
        }
    }

    $(function () {
        if (!$.trim($('#reviewsList').html()))
            $('#reviews').hide();
        vshopPager('pager', $('#txtTotal').val(), 1, 20);
    });

</script>
